import * as React from "react";

export interface HelloProps {
    compiler: string;
    framework: string;
}

// 'HelloProps' describes the shape of props.
// State is never set so we use the '{}' type.
export class ExampleTypeScript extends React.Component<HelloProps, {}> {
    state = {
        show_text: 'nothing'
    };

    constructor(props: HelloProps) {
        super(props);
        this.state = {
            show_text: "abc"
        };
    }

    componentDidMount(){
        console.log('call componentDidMount.')
    };

    render() {
        return (
            <div>
                <h1>Hello from {this.props.compiler} and {this.props.framework}!</h1>
                <button type="button" onClick={this.work} className="btn btn-primary">主要按钮</button>
                <span>{this.state.show_text}</span>
            </div>);
    }

    work = () => {
        console.log('i work. no i, modify.23');
        this.setState({
            texta: 'abc'
        });
    }
}